import request from '@/utils/request'

/**
 * 新增分组
 */
export function groupSave(data) {
  return request({
    url: '/userNotes/sysUserNotesGroup/save',
    method: 'post',
    data: data
  })
}

/**
 * 删除分组
 */
export function delGroupById(id) {
  return request({
    url: '/userNotes/sysUserNotesGroup/' + id,
    method: 'delete'
  })
}

/**
 * 生成一个请求 左侧列树
 */
export function group() {
  return request({
    url: '/userNotes/sysUserNotesGroup/group',
    method: 'get'
  })
}

/**
 * 点击某个分组
 */
export function textByGroupId(query) {
  return request({
    url: '/userNotes/sysUserNotesText/byGroupId',
    method: 'get',
    params: query
  })
}

/**
 * 点击某个笔记
 */
export function textById(id) {
  return request({
    url: '/userNotes/sysUserNotesText/' + id,
    method: 'get'
  })
}

/**
 * 新增/保存笔记
 */
export function textSave(data) {
  return request({
    url: '/userNotes/sysUserNotesText/save',
    method: 'post',
    data: data
  })
}

/**
 * 关注笔记
 */
export function collectionSave(data) {
  return request({
    url: '/userNotes/sysUserNotesCollection/save',
    method: 'post',
    data: data
  })
}

/**
 * 取消收藏
 */
export function collectionCancel(data) {
  return request({
    url: '/userNotes/sysUserNotesCollection/cancel',
    method: 'post',
    data: data
  })
}

/**
 * 给笔记添加标签
 */
export function saveTag(data) {
  return request({
    url: '/userNotes/sysUserNotesText/saveTag',
    method: 'post',
    data: data
  })
}

/**
 * 分享笔记
 */
export function shareText(data) {
  return request({
    url: '/userNotes/sysUserNotesText/shareText',
    method: 'post',
    data: data
  })
}

/**
 * 移动笔记
 */
export function move(data) {
  return request({
    url: '/userNotes/sysUserNotesText/move',
    method: 'post',
    data: data
  })
}

/**
 * 修改笔记标记
 */
export function updateLabelType(data) {
  return request({
    url: '/userNotes/sysUserNotesText/updateLabelType',
    method: 'post',
    data: data
  })
}

/**
 * 删除笔记
 */
export function delTextById(id) {
  return request({
    url: '/userNotes/sysUserNotesText/' + id,
    method: 'delete'
  })
}

/**
 * 分组列表
 */
export function groupList() {
  return request({
    url: '/userNotes/sysUserNotesGroup/list',
    method: 'get'
  })
}

/**
 * 点击某个标签
 */
export function textByTag(query) {
  return request({
    url: '/userNotes/sysUserNotesText/byTag',
    method: 'get',
    params: query
  })
}

/**
 * 分享给我
 */
export function shareToMe(data) {
  return request({
    url: '/userNotes/sysUserNotesText/shareToMe',
    method: 'post',
    data: data
  })
}

/**
 * 我关注的
 */
export function iFollow(data) {
  return request({
    url: '/userNotes/sysUserNotesText/iFollow',
    method: 'post',
    data: data
  })
}

/**
 * 获取当前用户的可见标签
 */
export function getUserTag() {
  return request({
    url: '/userNotes/sysUserNotesGroup/getUserTag',
    method: 'get'
  })
}

/**
 * 高级搜索
 */
export function searchText(data) {
  return request({
    url: '/userNotes/sysUserNotesText/searchText',
    method: 'post',
    data: data
  })
}

/**
 * 修改分类
 */
export function updateTypeById(id, type) {
  return request({
    url: '/userNotes/sysUserNotesText/updateTypeById',
    method: 'get',
    params: { id: id, type: type }
  })
}

/**
 * 历史列表
 */
export function historyList(query) {
  return request({
    url: '/userNotes/sysUserNotesText/history',
    method: 'get',
    params: query
  })
}

/**
 * 历史详情
 */
export function historyById(id) {
  return request({
    url: '/userNotes/sysUserNotesText/historyById/' + id,
    method: 'get'
  })
}

/**
 * 移动笔记
 */
export function moveText(textId, groupId) {
  return request({
    url: '/userNotes/sysUserNotesText/moveText/' + textId + '/' + groupId,
    method: 'get'
  })
}
